package v1

import (
	"github.com/gin-gonic/gin"
	"guns-go/model/request"
	"guns-go/model/response"
	"guns-go/service"
)

// @Tags OpLog
// @Summary 操作日志分页查询
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysOpLogParam true "请求参数"
// @Success 200 {string} string "{"success":true,"data":{},"message":"请求成功","code":200}"
// @Router /sysOpLog/page [get]
func SysOpLogPage(c *gin.Context) {

	var O request.SysOpLogParam
	_ = c.ShouldBindQuery(&O)

	err, sysOpLogPageResult := service.SysOpLogPage(&O, c)

	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.OkWithData(sysOpLogPageResult, c)
}

// @Tags OpLog
// @Summary 操作日志删除
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysOpLogParam true "请求参数"
// @Success 200 {string} string "{"success":true,"data":{},"message":"请求成功","code":200}"
// @Router /sysOpLog/delete [post]
func SysOpLogDelete(c *gin.Context) {

	err := service.DeleteSysOpLog()

	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.Ok(c)
}
